﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.Management.Automation;

namespace HyperVSnapin.Object
{
    public class Host : HyperVObject
    {
        protected internal Host(ManagementObject mo) 
            : base(mo)
        {
            Host.StaticHost = this;
        }

        protected internal Host(ManagementObject mo, string connectionAddress, PSCredential credential)
            : base(mo)
        {
            this.ConnectionAddress = connectionAddress;
            this.ConnectionCredential = credential;
            Host.StaticHost = this;
        }


        #region statics
        /// <summary>
        /// Last host connected.
        /// </summary>
        /// <remarks>All methods using a Host as entry will use this one if no Hyper-V is provided</remarks>
        protected internal static Host StaticHost
        {
            get;
            set;
        }
        #endregion

        public override string Name
        {
            get
            {
                return (string)base.ManagmenetObject.Properties["ElementName"].Value;
            }
        }

        protected internal string ConnectionAddress
        {
            get;
            set;
        }

        protected internal PSCredential ConnectionCredential
        {
            get;
            set;
        }
    }
}
